package com.fpost.domain;

import java.util.Date;

public class ArticleVersion {

	private long articleVersionId;
	private Article article;
	private long articleTypeId;
	private String title;
	private String summary;
	private String body;
	private Date createdOn;
	private String keywords;
	private String createdIp;
	private long hitCount;
	private boolean latestVersion;
	private boolean deleted;
	private long lockSeqNum;

	public void incrementHitCount() {
		this.hitCount++;
	}

	public long getArticleVersionId() {
		return articleVersionId;
	}

	public void setArticleVersionId(long articleVersionId) {
		this.articleVersionId = articleVersionId;
	}

	public Article getArticle() {
		return article;
	}

	public void setArticle(Article article) {
		this.article = article;
	}

	public long getArticleTypeId() {
		return articleTypeId;
	}

	public void setArticleTypeId(long articleTypeId) {
		this.articleTypeId = articleTypeId;
	}

	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {		
		//this.title = title.replace("'", "\'");
		this.title = title;
	}

	public String getSummary() {
		return summary;
	}

	public void setSummary(String summary) {
		this.summary = summary;
	}

	public String getBody() {
		return body;
	}

	public void setBody(String body) {
		//this.body = body.replace("'", "\'");
		this.body = body;
	}

	public String getKeywords() {
		return keywords;
	}

	public void setKeywords(String keywords) {
		//this.keywords = keywords.replace("'", "\'");
		this.keywords = keywords;
	}

	public Date getCreatedOn() {
		return createdOn;
	}

	public void setCreatedOn(Date createdOn) {
		this.createdOn = createdOn;
	}


	public String getCreatedIp() {
		return createdIp;
	}

	public void setCreatedIp(String createdIp) {
		this.createdIp = createdIp;
	}

	public long getHitCount() {
		return hitCount;
	}

	public void setHitCount(long hitCount) {
		this.hitCount = hitCount;
	}

	public long getLockSeqNum() {
		return lockSeqNum;
	}

	public void setLockSeqNum(long lockSeqNum) {
		this.lockSeqNum = lockSeqNum;
	}

	public boolean isLatestVersion() {
		return latestVersion;
	}

	public void setLatestVersion(boolean latestVersion) {
		this.latestVersion = latestVersion;
	}

	public boolean isDeleted() {
		return deleted;
	}

	public void setDeleted(boolean deleted) {
		this.deleted = deleted;
	}

	public void printDetails() {

		System.out.println("Version details:");
		System.out.println("--articleVersionId=" + getArticleVersionId());
		System.out.println("--articleId=" + getArticle().getArticleId());
		System.out.println("--articleTypeId=" + getArticleTypeId());
		System.out.println("--title=" + getTitle());
		System.out.println("--createdOn=" + getCreatedOn());
		System.out.println("--createdIp=" + getCreatedIp());
		System.out.println("--body=" + getBody());
		System.out.println("--keywords=" + getKeywords());
		System.out.println("--hitCount=" + getHitCount());
		System.out.println("--latestVersion=" + isLatestVersion());

	}

}
